<template>
       <div>
        <van-nav-bar
          title="通知"
         
          
  />
      <van-notice-bar
        left-icon="volume-o"
        :scrollable="true"
        :delay="2000"
        :speed="100"
        mode="closeable"
        text="详细信息请查看卡片"
      ></van-notice-bar>
    <van-image
      v-for="image in imageList"
      :src="image"
      @click="previewImage(image)"
    />
    <van-popup v-model:show="previewVisible" position="center">
      <van-image :src="previewSrc"/>
    </van-popup>
  </div>

</template>

<script>
import { defineComponent,onMounted,reactive,ref } from 'vue'
import {getImgSrc} from '../api'
export default defineComponent({
    setup() {
      const imageList=ref([]) 
      const parameter=reactive({});
      const previewVisible = ref(false);
      const previewSrc = ref('');
      const previewImage = (image) => {
      previewSrc.value = image;
      previewVisible.value = true;
    };

      onMounted(()=>{
        var currentURL = window.location.href;
         parameter.taskId=currentURL.split("?")[2].split("=")[1]
         let code=currentURL.split("?")[1].split("&")[0].split("=")[1]
            localStorage.setItem("code", code )
        getImgSrc({taskId:parameter.taskId}).then((res)=>{
          if(res.data.code==="200"){
            let data=res.data.data
           imageList.value.push(data.noticeReceivedSrc)
           }else{
             showNotify({ type: 'danger', message: res.data.msg });
           }   
        })
      })
      return  {
        imageList,
        previewSrc,
        previewVisible,
        previewImage,
      }
    },

   
})
</script>

<style>

</style>